package action.concreteActions;

import grammer.LocalObject;
import person.Location;
import person.PersonAchive;
import timer.Timer;
import action.ExecuteActionInterface;

/**
 * 
 * 
 * @author Minodor
 * 
 *         Used for predicates: enters
 */
public class GoToAction extends ExecuteActionInterface {
	private Location nextLocation;

	public GoToAction(Timer executeTime, LocalObject l) {
		super(executeTime);
		nextLocation = new Location();
		nextLocation.setCurrent(l.getLocation());
	}

	@Override
	public int execute() {
		if (PersonAchive.getPerson(this.getOnwer()) != null)
			PersonAchive.getPerson(this.getOnwer()).setCurrentLocation(
					nextLocation);
		return 0;
	}

	@Override
	public int getEndTimer() {
		return executeTime.getTime();
	}

	@Override
	public int getExecuteTimer() {
		return executeTime.getTime();
	}

	@Override
	public int getStartTimer() {
		return executeTime.getTime();
	}

}
